﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace nwrole.toolbox.sync.entity
{

    public class nhEntityViewColumn 
    {
        public enum BindingTypeEnum
        {
            Bound = 0,
            Template = 1
        }

        public virtual long Id { get; set; }
        public virtual string Name { get; set; }

        public virtual string HtmlAttributes { get; set; }
        public virtual string Title { get; set; }
        public virtual string Template { get; set; }

        public virtual DateTime? CreatedDate { get; set; }

        public virtual DateTime? ModifiedDate { get; set; }

        public virtual BindingTypeEnum BindingType { get; set; }

        public virtual nhEntityViewColumn Parent { get; set; }

        public virtual nhEntityView nhEntityView { get; set; }

        public virtual nhEntityColumn nhEntityColumn { get; set; }
    }

    public class nhEntityViewColumnMapping : ClassMap<nhEntityViewColumn>
    {

        public nhEntityViewColumnMapping()
        {
            Id(x => x.Id);
            Map(x => x.Name).Length(50).Not.Nullable();
            Map(x => x.Template);
            Map(x => x.HtmlAttributes);
            Map(x => x.BindingType).CustomType<int>(); 
            Map(x => x.CreatedDate);
            Map(x => x.ModifiedDate);
            References(x => x.nhEntityView).Column("nhEntityViewId");
            References(x => x.Parent).Column("nhEntityViewColumnId");
            References(x => x.nhEntityColumn).Column("nhEntityColumnId");
        }

    }

}
